﻿//-----------------------------------------------------------------------
// <copyright file="ProprietorFactory.cs" company="Mulala">
//     Copyright Mulala. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Mulala.Cavan.Domain.MainBoundedContext.ProprietorModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Mulala.Cavan.Domain.MainBoundedContext.SecurityModule;
    using Mulala.Cavan.Domain.MainBoundedContext.DictionaryModule;
    using Mulala.Cavan.Domain.MainBoundedContext.ConsignModule;
    using Mulala.Cavan.Domain.MainBoundedContext.Setting;

    public static class ProprietorFactory
    {
        public static Proprietor CreateProprietor(
                                    UserAccount userAccount,
                                    string name,
                                    bool namePrivacy,
                                    string contactEmail,
                                    bool contactEmailPrivacy,
                                    Area area,
                                    string telephone,
                                    bool telephonePrivacy,
                                    string address,
                                    bool addressPrivacy,
                                    string introduce,
                                    IList<Consign> consigns,
                                    ProprietorStatus proprietorStatus,
                                    DateTime editTime,
                                    string editUser)
        {
            Proprietor proprietor = new Proprietor();
            proprietor.Address = address;
            proprietor.AddressPrivacy = addressPrivacy;
            proprietor.Area = area;
            proprietor.Consigns = consigns;
            proprietor.ContactEmail = contactEmail;
            proprietor.ContactEmailPrivacy = contactEmailPrivacy;
            proprietor.EditTime = editTime;
            proprietor.EditUser = editUser;
            proprietor.Introduce = introduce;
            proprietor.Name = name;
            proprietor.NamePrivacy = namePrivacy;
            if (null != proprietorStatus)
            {
                proprietor.ProprietorStatus = proprietorStatus;
                proprietorStatus.Proprietor = proprietor;
            }
            proprietor.Telephone = telephone;
            proprietor.TelephonePrivacy = telephonePrivacy;
            proprietor.UserAccount = userAccount;
            proprietor.CreateTime = DateTime.Now;

            return proprietor;
        }

        public static Proprietor CreateProprietor(
                                    UserAccount userAccount,
                                    ProprietorStatus proprietorStatus,
                                    Area area)
        {
            Proprietor proprietor = CreateProprietor(userAccount, Project.Settings.DefaultInfo, true,
                                                    Project.Settings.DefaultInfo, true, area,
                                                    Project.Settings.DefaultInfo, true, Project.Settings.DefaultInfo,
                                                    true, Project.Settings.DefaultInfo, null, proprietorStatus, DateTime.Now, userAccount.Name);

            return proprietor;
        }

        public static Proprietor CreateProprietor(
                                    int id)
        {
            Proprietor proprietor = new Proprietor();
            proprietor.ID = id;

            return proprietor;
        }
    }
}
